<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition template="template.xhtml">
	<ui:define name="title">Cadastro Pacientes</ui:define>
	<ui:define name="content">
		<script type="text/javascript">
		$(document).ready(function(){			
			$('.cpf').mask("999.999.999-99");
			$('.cep').mask("99999-999");
			$('.telefone').mask("(99) 9999-9999");
			$('.celular').mask("(99) 9999-9999");
		});
		</script>		
		
		<div id="page-heading">
			<div class="icons-telas paciente"></div>
			<h1>Paciente</h1>
		</div>
		<table border="0" width="100%" cellpadding="0" cellspacing="0"
			id="content-table">
			<tr>
				<th rowspan="3" class="sized"><img
					src="images/shared/side_shadowleft.jpg" width="20" height="300"
					alt="" /></th>
				<th class="topleft"></th>
				<td id="tbl-border-top">&nbsp;</td>
				<th class="topright"></th>
				<th rowspan="3" class="sized"><img
					src="images/shared/side_shadowright.jpg" width="20" height="300"
					alt="" /></th>
			</tr>
			<tr>
				<td id="tbl-border-left"></td>
				<td>
					<!--  start content-table-inner -->
					<div id="content-table-inner">
						<h:form>
							<table border="0" width="100%" cellpadding="0" cellspacing="0">
								<tr valign="top">
									<td>
										<!--  start step-holder -->
										<div id="step-holder">
											<div class="step-no">1</div>
											<div class="step-dark-left">
												<a href="">Cadastrar Paciente</a>
											</div>
											<div class="step-dark-right">&nbsp;</div>
											<!--div class="step-no-off">2</div>
											<div class="step-light-left">Salvar</div>
											<div class="step-light-round">&nbsp;</div>
											<div class="clear"></div-->
										</div> <!--  end step-holder --> <!-- start id-form -->
										<table border="0" cellpadding="0" cellspacing="0" id="id-form">
											<tr>
												<th valign="top">Nome Completo:*</th>
												<td><h:inputText styleClass="inp-form" id="nome"
														maxlength="255"
														autocomplete="off"
														value="#{pacienteBean.nome}" required="true">
														</h:inputText></td>
												<td><h:message for="nome" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Data de Nascimento:*</th>
												<td>
													<rich:calendar datePattern="dd/MM/yyyy"  id="data_nasc" value="#{pacienteBean.data_nascimento}" required="true" validator="#{pacienteBean.validaDataFutura}" binding="#{pacienteBean.dataValidation}"></rich:calendar>
												</td>
												<td><h:message for="data_nasc" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">RG:*</th>
												<td><h:inputText styleClass="inp-form" id="rg"
														value="#{pacienteBean.rg}" required="true"
														maxlength="15"
														requiredMessage="Campo Obrigatório" validator="#{pacienteBean.validaExistenciaPacientePorRg}">
															<f:convertNumber for="rg"></f:convertNumber>
															<f:validateLength maximum="10"></f:validateLength>
														</h:inputText></td>
												<td><h:message for="rg" errorClass="error-inner" lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">CPF:*</th>
												<td><h:inputText styleClass="inp-form cpf" id="cpf"
														value="#{pacienteBean.cpf}" required="true"
														maxlength="15"
														requiredMessage="Campo Obrigatório" validator="#{pacienteBean.validaExistenciaPacientePorCpf}">															
															<f:param id="idpaciente" name="idpaciente" value="0"></f:param>																																													
														</h:inputText></td>
												<td><h:message for="cpf" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Sexo:*</th>
												<td><h:selectOneRadio value="#{pacienteBean.sexo}"
														id="sexo" required="true"
														requiredMessage="Campo Obrigatório">
														<f:selectItem itemLabel="Masculino" itemValue="m"></f:selectItem>
														<f:selectItem itemLabel="Feminino" itemValue="f"></f:selectItem>
													</h:selectOneRadio></td>
												<td><h:message for="sexo" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Endereço:*</th>
												<td><h:inputText styleClass="inp-form" id="endereco"
														value="#{pacienteBean.endereco}" required="true"
														maxlength="255"
														requiredMessage="Campo Obrigatório"></h:inputText></td>
												<td><h:message for="endereco" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">CEP:*</th>
												<td><h:inputText styleClass="inp-form cep" id="cep"
														value="#{pacienteBean.cep}" required="true"
														maxlength="10"
														requiredMessage="Campo Obrigatório"></h:inputText></td>
												<td><h:message for="cep" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Telefone:*</th>
												<td><h:inputText styleClass="inp-form telefone" id="telefone"
														value="#{pacienteBean.telefone}" required="true"
														maxlength="18"
														requiredMessage="Campo Obrigatório"></h:inputText></td>
												<td><h:message for="telefone" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Celular:</th>
												<td><h:inputText styleClass="inp-form celular" id="celular"
														value="#{pacienteBean.celular}"
														maxlength="18"
														></h:inputText></td>
												<td><h:message for="celular" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Email:</th>
												<td><h:inputText styleClass="inp-form" id="email" maxlength="50"
														value="#{pacienteBean.email}"  validatorMessage="Email Inválido">
										                    <f:validateRegex
	                        									pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,3})+$">
	                       									</f:validateRegex>
                    										<rich:validator />														
														</h:inputText></td>
												<td><h:message for="email" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Convênio:*</th>
												<td><h:selectOneMenu
														value="#{pacienteBean.id_convenio}" id="convenio"
														required="true" requiredMessage="Campo Obrigatório">
														<f:selectItem itemValue="0" itemDisabled="true" itemLabel="Selecione"></f:selectItem>
														<f:selectItems value="#{listas.listaConvenioSelect}"></f:selectItems>
													</h:selectOneMenu></td>
												<td><h:message for="convenio" errorClass="error-inner"
														lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Início do tratamento:*</th>
												<td>
													<rich:calendar datePattern="dd/MM/yyyy" id="inicio_tratamento" value="#{pacienteBean.inicio_tratamento}" required="true" validator="#{pacienteBean.validaDataInicioTratamento}" ></rich:calendar>
												</td>
												<td><h:message for="inicio_tratamento" errorClass="error-inner" lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Diagnostico:*</th>
												<td>
													<rich:pickList id="diagnostico" value="#{pacienteBean.listaDiagnosticos}" addAllText="Adicionar Todos" addText="Adicionar"
															removeAllText="Remover Todos" removeText="Remover" minListHeight="150px" upText="Diagnósticos" columnClasses="pickerTexArea" >
														<f:selectItems value="#{listas.listaCidSelect}"></f:selectItems>														
													</rich:pickList>																					
												</td>
												<td><h:message for="diagnostico" errorClass="error-inner" lang="pt"></h:message></td>
											</tr>
											<tr>
												<th valign="top">Histórico:</th>
												<td><h:inputTextarea styleClass="form-textarea"
														id="historico" value="#{pacienteBean.historico_clinico}"></h:inputTextarea>
												</td>
												<td></td>
											</tr>
											<tr>
												<th>&nbsp;</th>
												<td valign="top">
													<h:inputHidden value="#{pacienteBean.id}" binding="#{pacienteBean.idPacienteValidation}">
													</h:inputHidden> <h:commandButton
														action="#{pacienteBean.Salvar}" styleClass="form-submit"
														type="submit" value="Salvar"></h:commandButton> 
													<a href="paciente_list.xhtml" class="form-cancel" title="cancelar">cancelar</a>
												</td>
												<td></td>
											</tr>
										</table> <!-- end id-form  -->
									</td>
									<td></td>
								</tr>
								<tr>
									<td><img src="images/shared/blank.gif" width="695"
										height="1" alt="blank" /></td>
									<td></td>
								</tr>
							</table>
						</h:form>

						<div class="clear"></div>


					</div> <!--  end content-table-inner  -->
				</td>
				<td id="tbl-border-right"></td>
			</tr>
			<tr>
				<th class="sized bottomleft"></th>
				<td id="tbl-border-bottom">&nbsp;</td>
				<th class="sized bottomright"></th>
			</tr>
		</table>

		<div class="clear">&nbsp;</div>
	</ui:define>
</ui:composition>
</html>